const fs = require('fs');
const path = require('path');

const dirStructure = [
  'src/views/error',
  'src/views/system/user',
  'src/views/system/role',
  'src/views/system/permission',
  'src/views/system/profile',
  'src/views/system/dict',
  'src/views/dashboard',
  'src/views/device',
  'src/views/login'
];

// 创建缺失的目录
dirStructure.forEach(dir => {
  const fullPath = path.join(__dirname, dir);
  if (!fs.existsSync(fullPath)) {
    console.log(`Creating directory: ${dir}`);
    fs.mkdirSync(fullPath, { recursive: true });
  }
});

// 如果系统dict目录下没有data.vue，创建一个简单的
const dictDataPath = path.join(__dirname, 'src/views/system/dict/data.vue');
if (!fs.existsSync(dictDataPath)) {
  console.log('Creating dict/data.vue');
  const content = `<template>
  <div class="app-container">
    <h1>字典数据</h1>
    <p>字典ID: {{ $route.params.id }}</p>
  </div>
</template>

<script>
export default {
  name: 'DictData',
  data() {
    return {}
  },
  created() {
    console.log('Dict data ID:', this.$route.params.id)
  }
}
</script>`;
  fs.writeFileSync(dictDataPath, content);
}

console.log('All directories and files checked!'); 